package com.battleship.modelo;

import java.util.ArrayList;
import java.util.List;

import com.battleship.utils.Constants;

public class Partida {
	
	private Usuario usuario1;
	private Usuario usuario2;
	
	private List<Barco> barcosUsu1;
	private List<Barco> barcosUsu2;
	
	private int turno;
	
	private int tableroUsu1[][] = new int[Constants.TABLE_WIDTH][Constants.TABLE_WIDTH]; 
	
	private int tableroUsu2[][] = new int[Constants.TABLE_WIDTH][Constants.TABLE_WIDTH]; 
	/* Estado inicial de los tableros despues de init()
									{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
									{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
	*/
	public Partida(){
		this.usuario1 = new Usuario();
		this.usuario2 = new Usuario();
		this.barcosUsu1 = new ArrayList<Barco>();
		this.barcosUsu2 = new ArrayList<Barco>();		
		this.turno = 0;
		init();
	}
	
	protected void init() {
		for(int w = 0; w<Constants.TABLE_WIDTH; w++) {
			for(int h = 0; h<Constants.TABLE_WIDTH; h++) {
				this.tableroUsu1[w][h] = Constants.BOX_WATER;
				this.tableroUsu2[w][h] = Constants.BOX_WATER;
			}
		}
	}
	
	public Partida(Partida partida){
		this.usuario1 = partida.getUsuario1();
		this.usuario2 = partida.getUsuario2();
		this.barcosUsu1 = partida.getBarcosUsu1();
		this.barcosUsu2 = partida.getBarcosUsu2();
		this.tableroUsu1 = partida.getTableroUsu1();
		this.tableroUsu2 = partida.getTableroUsu2();
		this.turno = partida.getTurno();
		
	}
	
	public Partida(Usuario usuario1, Usuario usuario2, List<Barco> barcosUsu1
			, List<Barco> barcosUsu2, int turno, int tableroUsu1[][], int tableroUsu2[][]){
		this.usuario1 = usuario1;
		this.usuario2 = usuario2;
		this.barcosUsu1 = barcosUsu1;
		this.barcosUsu2 = barcosUsu2;
		this.tableroUsu1 = tableroUsu1;
		this.tableroUsu2 = tableroUsu2;
		this.turno = turno;
	}
	
	public Usuario getUsuario1() {
		return usuario1;
	}
	public void setUsuario1(Usuario usuario1) {
		this.usuario1 = usuario1;
	}
	public Usuario getUsuario2() {
		return usuario2;
	}
	public void setUsuario2(Usuario usuario2) {
		this.usuario2 = usuario2;
	}
	public List<Barco> getBarcosUsu1() {
		return barcosUsu1;
	}
	public void setBarcosUsu1(List<Barco> barcosUsu1) {
		this.barcosUsu1 = barcosUsu1;
	}
	public List<Barco> getBarcosUsu2() {
		return barcosUsu2;
	}
	public void setBarcosUsu2(List<Barco> barcosUsu2) {
		this.barcosUsu2 = barcosUsu2;
	}
	public int getTurno() {
		return turno;
	}
	public void setTurno(int turno) {
		this.turno = turno;
	}
	public int[][] getTableroUsu1() {
		return tableroUsu1;
	}
	public void setTableroUsu1(int[][] tableroUsu1) {
		this.tableroUsu1 = tableroUsu1;
	}
	public int[][] getTableroUsu2() {
		return tableroUsu2;
	}
	public void setTableroUsu2(int[][] tableroUsu2) {
		this.tableroUsu2 = tableroUsu2;
	}

}
